package cn.johnyu.pojo;

import io.swagger.v3.oas.annotations.media.Schema;

@Schema(name = "Book", description = "书籍")
public class Book {
    private Integer id;
    @Schema(description = "书名",example = "Java编程思想")
    private String name;
    @Schema(description = "作者",implementation = Author.class)
    private Author author;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Author getAuthor() {
        return author;
    }

    public void setAuthor(Author author) {
        this.author = author;
    }

    //    生成一个工具方法，批量生一批Book对象
    public static Book[] getBooks(){
        Book[] books=new Book[10];
        for (int i = 0; i < books.length; i++) {
            Book book=new Book();
            book.setId(i);
            book.setName("book"+i);
            books[i]=book;
        }
        return books;
    }
}
